/*
 * MidiFootswitch.cpp
 *
 *  Created on: 07/lug/2011
 *      Author: marcolembo
 */

#include "MidiFootswitch.h"

#include "MidiCcStrategy.h"
#include "MidiNoteStrategy.h"
#include "MidiButton.h"
#include "FootsDriver.h"

#include "MIDI.h"

namespace ml {

	MidiFootswitch::MidiFootswitch(
	                               short _pos,
	                               Driver* _drv)
	: MidiButton(_drv),
	  m_oldValue(0),
	  m_pos(_pos)
	{
	}

	short MidiFootswitch::ReadValue() const
	{
	    //delego/uso il degli ingressi per ricevere
	    return static_cast<FootsDriver*>(m_driver)->ReadFootStatus(m_pos);
	}

    void MidiFootswitch::SendMidiEvent()
    {
        short newValue = ReadValue();
        m_strategy->SendMidiEvent(newValue); //a seconda della strategia settata --> invia evento midi (nota o CC)
    }

	MidiFootswitch::~MidiFootswitch() {
	}

}
